package main

import (
	"context"
	"go.uber.org/zap"
	"os"
	"os/signal"
	"protohook/zlogger"
	"syscall"
)

func  main() {
	defer func() {
		zap.S().Info("[进程] 进程结束")
	}()
	// 初始化logger
	zlogger.InitLogger(&globalXmlConfig.Log)
	ctx, cancel := context.WithCancel(context.Background())
	ROHookProxyServe(ctx)
	stopChan := make(chan os.Signal)
	signal.Notify(stopChan, syscall.SIGQUIT, syscall.SIGKILL, syscall.SIGTERM, syscall.SIGINT)
	select {
	case sig := <-stopChan:
		cancel()
		close(stopChan)
		zap.S().Infof("[进程] 结束, 信号:%s", sig)
		break
	}
}
